package com.ruoyi.web.controller.prevention;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.entity.PreventionSecurityRiskRefresh;
import com.ruoyi.system.service.PreventionSecurityRiskRefreshService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

/**
 * 双重预防-风险分析清单明细_刷新任务表(PreventionSecurityRiskRefresh)表控制层
 * @since 2023-05-08 14:19:01
 */
@RestController
@RequestMapping("preventionSecurityRiskRefresh")
public class PreventionSecurityRiskRefreshController extends BaseController {

    @Resource
    private PreventionSecurityRiskRefreshService preventionSecurityRiskRefreshService;

    /**
     * 分页查询
     * @return 查询结果
     */
    @GetMapping("/list")
    public TableDataInfo queryByPage(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        startPage();
        List<PreventionSecurityRiskRefresh> preventionSecurityRiskRefreshes = preventionSecurityRiskRefreshService.queryByPage(preventionSecurityRiskRefresh);
        return getDataTable(preventionSecurityRiskRefreshes);
    }

    /**
     * 通过主键查询单条数据
     * @return 单条数据
     */
    @GetMapping("{id}")
    public AjaxResult queryById(@PathVariable("id") Integer id) {
        return AjaxResult.success(this.preventionSecurityRiskRefreshService.queryById(id));
    }

    /**
     * 新增数据
     * @return 新增结果
     */
    @PostMapping("/create")
    public AjaxResult add(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        return AjaxResult.success(this.preventionSecurityRiskRefreshService.insert(preventionSecurityRiskRefresh));
    }

    /**
     * 编辑数据
     * @return 编辑结果
     */
    @PostMapping("/update")
    public AjaxResult uodate(PreventionSecurityRiskRefresh preventionSecurityRiskRefresh) {
        return AjaxResult.success(this.preventionSecurityRiskRefreshService.update(preventionSecurityRiskRefresh));
    }

    /**
     * 删除数据
     * @return 删除是否成功
     */
    @GetMapping("/delete")
    public AjaxResult deleteById(Integer id) {
        return AjaxResult.success(this.preventionSecurityRiskRefreshService.deleteById(id));
    }

}

